# 读取完整的建表语句，并且将每张表的建表语句单独提取出来并写入ddl/mysql中
with open("./data/traffic_crm_2025-06-10_094406.sql",mode='r',encoding='utf8') as f:
    sep = "--------------------------"
    for table in "".join(f.readlines()).split(sep):
        # 去除字符串左右的隐藏字符
        table_strip = table.strip()
        if table_strip != "":
            # 提取表名字
            table_name = table_strip.split(";")[0].split("`")[1]
            with open(f"./ddl/mysql/{table_name}.sql",mode='w',encoding='utf8') as w:
                w.write(table_strip)

